﻿Public Class Rrespuesta

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of Erespuesta)
        Dim respuestas As List(Of Erespuesta) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                respuestas = Drespuesta.SeleccionarTodo(descEmpresa)
                If respuestas Is Nothing Then respuestas = New List(Of Erespuesta)
                If DisplaySelect Then respuestas.Insert(0, New Erespuesta("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return respuestas
    End Function
    Public Shared Function SeleccionarTodoxEstado(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of Erespuesta)
        Dim respuestas As List(Of Erespuesta) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                respuestas = Drespuesta.SeleccionarTodoxEstado(descEmpresa)
                If respuestas Is Nothing Then respuestas = New List(Of Erespuesta)
                If DisplaySelect Then respuestas.Insert(0, New Erespuesta("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return respuestas
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal ent As Erespuesta) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = Drespuesta.Añadir(descEmpresa, ent)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal ent As Erespuesta) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = Drespuesta.Editar(descEmpresa, ent)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Eliminar(ByVal descEmpresa As String, ByVal respuesta As Erespuesta) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = Drespuesta.Eliminar(descEmpresa, respuesta)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
